package com.cisetech.web.bobocai.qiantai;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cisetech.service.LCustomerMessageService;
import com.cisetech.vo.bobocai.LCustomer;
import com.cisetech.vo.bobocai.LCustomerMessage;

/**
 * 用户留言控制器
 * @author Administrator
 *
 */
@Controller
@RequestMapping(value="customerMesage")
public class CustomerMesageController {
	@Autowired
	LCustomerMessageService LCustomerMessageMapper;
	
	
	@ResponseBody
	@RequestMapping(value="insert",method=RequestMethod.POST)
	public int inset(LCustomerMessage customerMessage,HttpServletRequest request,HttpServletResponse response){
		LCustomer customer = (LCustomer)request.getSession().getAttribute("LCustomer");
		int i = 2;
		if(customer==null){
			return i;
		}
		customerMessage.setCustomerCode(customer.getEmail());
		i = LCustomerMessageMapper.insert(customerMessage);
		return i;
	}
}
